<template>
	<view class="kind">
		<!-- 分类 -->
		<view class="item" v-for="item in kindList" :key="item.id" @tap="goGoods(item.id)">
			<view class="name">{{item.name}}</view>
			<image class="img" :src="item.icon"></image>
		</view>
	</view>
</template>

<script>
	import { findCategory } from '../../api/kind/index.js'
	export default {
		data() {
			return {
				kindList:[], // 列表 - 分类
			};
		},
		onLoad() {
			findCategory('1308336521604599809').then(res=>{
				this.kindList = res.data.data.category.children
			})
		},
		methods: {
			// 跳转到商品页
			goGoods(val){
				uni.navigateTo({
					url: `./goods/goods?id=${val}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
@import './index.scss'
</style>
